﻿/**
 *
 * @file FITKAbaqusHDF5AdaptorAssembly.h
 * @brief 读写HDF5文件的ASSembly类
 * @author fulipeng (fulipengqd@yeah.net)
 * @date 2024-05-31
 *
 */
#ifndef  _FITKABAQUSHDF5ADAPTORASSEMBLY_H__
#define  _FITKABAQUSHDF5ADAPTORASSEMBLY_H__

#include "FITKAbaqusIOHDF5API.h"
#include "FITKAbaqusHDF5AbstractAdaptor.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include "FITK_Interface/FITKInterfaceIOHDF5/FITKInterfaceHDF5AdaptorAssembly.h"

 //前置声明
ForwardDeclarNS(Interface, FITKAbaAssembly)
ForwardDeclarNS(Interface, FITKModelSet)
ForwardDeclarNS(Interface, FITKMeshSurface)
ForwardDeclarNS(Interface, FITKNodeList)
ForwardDeclarNS(Interface, FITKAbaRefPointManager)
ForwardDeclarNS(Interface, FITKCoordinateSystem)
ForwardDeclarNS(Interface, FITKAbaAbstractInertia)
ForwardDeclarNS(Interface, FITKAbaAbstractSpringDashpot)
ForwardDeclarNS(Interface, FITKAbaWire)
ForwardDeclarNS(Interface, FITKAbaConnectorAssignment)

namespace IO
{
    /**
     * @brief HDF5 Assembly 读写适配器
     * @author fulipeng (fulipengqd@yeah.net)
     * @date 2024-05-31
     */
    class FITKABAQUSIOHDF5API FITKAbaqusHDF5AdaptorAssembly : public FITKInterfaceHDF5AdaptorAssembly
    {
    public:
        explicit FITKAbaqusHDF5AdaptorAssembly() = default;
        virtual ~FITKAbaqusHDF5AdaptorAssembly() = default;

        /**
         * @brief 获取适配器数据类型名
         * @return 适配器数据类型名
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-05-31
         */
        QString getAdaptorClass() override;

        /**
         * @brief 适配器读取
         * @return 状态 true成功， false失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-05-31
         */
        bool adaptR() override;

        /**
         * @brief 适配器写出
         * @return 状态 true成功， false失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-05-31
         */
        bool adaptW() override;

    protected:

        /**
         * @brief 读取装配
         * @param assembly 装配
         * @param h5Group
         * @return 状态 true成功， false失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-06-13
         */
        virtual bool readAssembly(Interface::FITKAssembly* assembly, H5::Group& h5Group) override;

        /**
         * @brief 读取节点
         * @param nodes 节点列表
         * @param h5Group
         * @return 状态 true成功， false失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-06-13
         */
        bool readNode(Interface::FITKNodeList* nodes, H5::Group& h5Group);

        /**
         * @brief 读取参考点
         * @param refPointManager 参考点管理器
         * @param h5Group
         * @return 状态 true成功， false失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-06-13
         */
        bool readRefPoint(Interface::FITKAbaRefPointManager* refPointManager, H5::Group& h5Group);

        /**
         * @brief 读取CoordinateSystem的数据
         * @param h5Group
         * @return 状态 true 成功 false 失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-06-05
         */
        bool readCoordinateSystem( H5::Group& h5Group);

        /**
         * @brief 读取Inertia的数据
         * @param h5Group
         * @return 状态 true 成功 false 失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-06-05
         */
        bool readInertia(H5::Group & h5Group);

        /**
         * @brief 读取SpringDashpot的数据
         * @param h5Group
         * @return 状态 true 成功 false 失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-06-21
         */
        bool readSpringDashpot(H5::Group & h5Group);

        /**
         * @brief 写出装配
         * @param assembly 装配
         * @param h5Group
         * @return 状态 true成功， false失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-06-13
         */
        virtual bool writeAssembly(Interface::FITKAssembly* assembly, H5::Group& h5Group) override;

        /**
         * @brief 写出节点
         * @param nodes 节点
         * @param h5Group
         * @return 状态 true成功， false失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-03-19
         */
        bool writeNode(Interface::FITKNodeList* nodes, H5::Group& h5Group);

        /**
         * @brief 写出参考点
         * @param refPointManager 参考点管理器
         * @param h5Group
         * @return 状态 true成功， false失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-03-19
         */
        bool writeRefPoint(Interface::FITKAbaRefPointManager* refPointManager, H5::Group& h5Group);

        /**
         * @brief 写出CoordinateSystem的数据
         * @param coordinateSystem 坐标系
         * @param h5Group
         * @return 状态 true 成功 false 失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-06-05
         */
        bool writeCoordinateSystem(Interface::FITKCoordinateSystem* coordinateSystem, H5::Group& h5Group);

        /**
         * @brief 写出Inertia的数据
         * @param Inertia 惯量
         * @param h5Group
         * @return 状态 true 成功 false 失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-06-05
         */
        bool writeInertia(Interface::FITKAbaAbstractInertia* inertia, H5::Group & h5Group);

        /**
         * @brief 写出SpringDashpot的数据
         * @param springDashpot 弹簧
         * @param h5Group
         * @return 状态 true 成功 false 失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-06-21
         */
        bool writeSpringDashpot(Interface::FITKAbaAbstractSpringDashpot* springDashpot, H5::Group & h5Group);

        /**
         * @brief 读取FITKAbaWire 线
         * @param h5Group
         * @return 状态 true 成功 false 失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-07-02
         */
        bool readWire(H5::Group & h5Group);

        /**
         * @brief 写出FITKAbaWire 线
         * @param wite 线
         * @param h5Group
         * @return 状态 true 成功 false 失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-07-02
         */
        bool writeWire(Interface::FITKAbaWire* wite, H5::Group & h5Group);


        /**
         * @brief 读取 连接器指派
         * @param h5Group
         * @return 状态 true 成功 false 失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-07-02
         */
        bool readConnectorAssign(H5::Group & h5Group);

        /**
         * @brief 写出 连接器指派
         * @param ca 连接器指派
         * @param h5Group
         * @return 状态 true 成功 false 失败
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-07-02
         */
        bool writeConnectorAssign(Interface::FITKAbaConnectorAssignment* ca, H5::Group & h5Group);

    private:

    };

    Register2FITKIOAdaptorFactory(HDF5, Interface::FITKAbaAssembly, FITKAbaqusHDF5AdaptorAssembly)
}

#endif
